CSharpTest.Net
Run(TextReader,String[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Processes Namespace > AssemblyRunner Class > Run Method : Run(TextReader,String[]) Method

input
arguments

Glossary Item Box

Runs the process with additional arguments and returns the exit code.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Run( _
   ByVal input As TextReader, _
   ByVal ParamArray arguments() As String _
) As Integer
C# 
public int Run( 
   TextReader input,
   params string[] arguments
)

Parameters

input
arguments

Example

Library/Library.Test/TestAssemblyRunner.cs

C#Copy Code
using (AssemblyRunner runner = new AssemblyRunner(Exe))
{
    List<string> lines = new List<string>();
    runner.OutputReceived += delegate(Object o, ProcessOutputEventArgs e) { lines.Add(e.Data); };
    int exitCode = runner.Run(new StringReader("Hello World\r\nWhatever!\r\nAnother line."));
    Assert.AreEqual(0, exitCode);

    // 0 == WorkingDirectory = 
    // 1 == std-input:
    Assert.AreEqual("Hello World", lines[2]);
    Assert.AreEqual("Whatever!", lines[3]);
    Assert.AreEqual("Another line.", lines[4]);
}
VB.NETCopy Code
Using runner As New AssemblyRunner(Exe)
    Dim lines As New List(Of String)()
    runner.OutputReceived += Function(o As [Object], e As ProcessOutputEventArgs) Do
        lines.Add(e.Data)
    End Function
    Dim exitCode As Integer = runner.Run(New StringReader("Hello World" & vbCr & vbLf & "Whatever!" & vbCr & vbLf & "Another line."))
    Assert.AreEqual(0, exitCode)

    ' 0 == WorkingDirectory = 
    ' 1 == std-input:
    Assert.AreEqual("Hello World", lines(2))
    Assert.AreEqual("Whatever!", lines(3))
    Assert.AreEqual("Another line.", lines(4))
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys